package com.lizhen.core.datastructure;

import java.util.Enumeration;
import java.util.Hashtable;

public class HashtableDataStructure {
    public static void main(String[] args) {
        Hashtable<String, Double> hashtable = new Hashtable<>();
        hashtable.put("Zara", new Double(3434.34));
        hashtable.put("Mahnaz", new Double(123.22));
        hashtable.put("Ayan", new Double(1378.00));
        hashtable.put("Daisy", new Double(99.22));
        hashtable.put("Qadir", new Double(-19.08));
        Enumeration<String> enumeration = hashtable.keys();

        while (enumeration.hasMoreElements()) {
            String str = enumeration.nextElement();

            System.out.println(str + ": " + hashtable.get(str));
        }

        Double doubleValue = hashtable.get("Zara");
        hashtable.put("Zara", doubleValue + 1000);

        System.out.println("Zara's new balance: " + hashtable.get("Zara"));
    }
}
